﻿using SuperFx;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace SuperMoney.WebMobile.Controllers
{
    public class TaskController : Controller
    {
        //
        // GET: /Task/CheckIn

		[HttpGet]
        public ActionResult CheckIn(string deviceId)
        {
			ViewBag.IsCheckIn = CheckInService.Instance.Exists(deviceId);
			ViewData["DeviceId"] = deviceId;
            return View();
        }

		//
		// POST: /Task/CheckIn
		
		[HttpPost]
		public ActionResult PostCheckIn(string deviceId)
		{
			try
			{
				CheckInService.Instance.CheckIn(deviceId);
				ViewBag.Success = true;
			}
			catch (Exception<BusinessExceptionArgs> ex)
			{
				ViewBag.Success = false;
				ViewBag.Message = ex.Message;
			}

			return View();
		}

    }
}
